/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * RegistrosProductos.java
 *
 * Created on 25/05/2011, 11:23:18 AM
 */

package GUI;

import Interfaz.Interfaz;
import java.io.File;
import javax.swing.ImageIcon;
import javax.swing.filechooser.FileNameExtensionFilter;

/**
 *
 * @author Vane
 */
public class RegistrosProductos extends javax.swing.JFrame {

    /** Creates new form RegistrosProductos */
	private Interfaz laInterfaz;
    public RegistrosProductos(Interfaz laInterfaz) {
		this.laInterfaz=laInterfaz;
        initComponents();
		this.setLocationRelativeTo(null); // Cambiar icono de java en ventana
        this.setIconImage(new ImageIcon("src/imagenes/marketplus2.png").getImage());
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        buttonGroup1 = new javax.swing.ButtonGroup();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jTNombreProducto = new javax.swing.JTextField();
        jLabel4 = new javax.swing.JLabel();
        jTFecha = new javax.swing.JTextField();
        jLabel5 = new javax.swing.JLabel();
        jTUnidades = new javax.swing.JTextField();
        jLabel6 = new javax.swing.JLabel();
        jTCargarImagen = new javax.swing.JTextField();
        jBRegistrarProducto = new javax.swing.JButton();
        jLabel7 = new javax.swing.JLabel();
        jTDescripcionProducto = new javax.swing.JTextField();
        jLabel8 = new javax.swing.JLabel();
        jRadioButton1 = new javax.swing.JRadioButton();
        jRadioButton2 = new javax.swing.JRadioButton();
        jTOfertas = new javax.swing.JTextField();
        jLabel9 = new javax.swing.JLabel();
        jLabel10 = new javax.swing.JLabel();
        jRadioButton3 = new javax.swing.JRadioButton();
        jRadioButton4 = new javax.swing.JRadioButton();
        jScrollPane1 = new javax.swing.JScrollPane();
        jEditorPane1 = new javax.swing.JEditorPane();
        jBEliminarProducto = new javax.swing.JButton();
        jBExaminar = new javax.swing.JButton();
        jLabel11 = new javax.swing.JLabel();
        jButton1 = new javax.swing.JButton();
        jTCodigoProducto = new javax.swing.JTextField();
        jBRegresar = new javax.swing.JButton();
        jFileChooser1 = new javax.swing.JFileChooser();
        jLabel12 = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setMinimumSize(new java.awt.Dimension(650, 650));
        setResizable(false);
        getContentPane().setLayout(null);

        jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/marketplus.png"))); // NOI18N
        getContentPane().add(jLabel1);
        jLabel1.setBounds(20, 10, 94, 80);

        jLabel2.setFont(new java.awt.Font("Tempus Sans ITC", 3, 18));
        jLabel2.setText("Registros de Productos");
        getContentPane().add(jLabel2);
        jLabel2.setBounds(220, 30, 240, 30);

        jLabel3.setText("Nombre del Producto:");
        getContentPane().add(jLabel3);
        jLabel3.setBounds(160, 120, 140, 20);
        getContentPane().add(jTNombreProducto);
        jTNombreProducto.setBounds(280, 120, 180, 20);

        jLabel4.setText("Fecha:");
        getContentPane().add(jLabel4);
        jLabel4.setBounds(400, 80, 50, 20);
        getContentPane().add(jTFecha);
        jTFecha.setBounds(450, 80, 100, 20);

        jLabel5.setText("Unidades:");
        getContentPane().add(jLabel5);
        jLabel5.setBounds(160, 150, 120, 20);
        getContentPane().add(jTUnidades);
        jTUnidades.setBounds(280, 150, 180, 20);

        jLabel6.setText("Cargar Imagen:");
        getContentPane().add(jLabel6);
        jLabel6.setBounds(160, 180, 120, 20);
        getContentPane().add(jTCargarImagen);
        jTCargarImagen.setBounds(280, 180, 180, 20);

        jBRegistrarProducto.setText("Registrar");
        getContentPane().add(jBRegistrarProducto);
        jBRegistrarProducto.setBounds(150, 450, 140, 30);

        jLabel7.setText("Perecedero:");
        getContentPane().add(jLabel7);
        jLabel7.setBounds(160, 250, 90, 20);
        getContentPane().add(jTDescripcionProducto);
        jTDescripcionProducto.setBounds(280, 210, 180, 20);

        jLabel8.setText("Descripcion:");
        getContentPane().add(jLabel8);
        jLabel8.setBounds(160, 210, 90, 20);

        jRadioButton1.setText("SI");
        getContentPane().add(jRadioButton1);
        jRadioButton1.setBounds(280, 240, 35, 23);

        jRadioButton2.setText("No");
        getContentPane().add(jRadioButton2);
        jRadioButton2.setBounds(280, 260, 39, 23);
        getContentPane().add(jTOfertas);
        jTOfertas.setBounds(280, 290, 180, 20);

        jLabel9.setText("% Ofertas:");
        getContentPane().add(jLabel9);
        jLabel9.setBounds(160, 290, 90, 20);

        jLabel10.setText("Promocion:");
        getContentPane().add(jLabel10);
        jLabel10.setBounds(160, 330, 90, 20);

        jRadioButton3.setText("SI");
        getContentPane().add(jRadioButton3);
        jRadioButton3.setBounds(280, 320, 60, 23);

        jRadioButton4.setText("No");
        getContentPane().add(jRadioButton4);
        jRadioButton4.setBounds(280, 340, 60, 23);

        jScrollPane1.setViewportView(jEditorPane1);

        getContentPane().add(jScrollPane1);
        jScrollPane1.setBounds(340, 320, 108, 70);

        jBEliminarProducto.setText("Eliminar");
        getContentPane().add(jBEliminarProducto);
        jBEliminarProducto.setBounds(330, 450, 140, 30);

        jBExaminar.setText("Examinar");
        jBExaminar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBExaminarActionPerformed(evt);
            }
        });
        getContentPane().add(jBExaminar);
        jBExaminar.setBounds(470, 180, 100, 23);

        jLabel11.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
        jLabel11.setText("RIF: J-122231245          Desarrollado por: Group Delivery");
        getContentPane().add(jLabel11);
        jLabel11.setBounds(180, 540, 320, 20);

        jButton1.setText("Generar Codigo");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });
        getContentPane().add(jButton1);
        jButton1.setBounds(150, 410, 140, 30);
        getContentPane().add(jTCodigoProducto);
        jTCodigoProducto.setBounds(330, 410, 130, 30);

        jBRegresar.setText("Regresar");
        jBRegresar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBRegresarActionPerformed(evt);
            }
        });
        getContentPane().add(jBRegresar);
        jBRegresar.setBounds(250, 510, 120, 23);
        getContentPane().add(jFileChooser1);
        jFileChooser1.setBounds(640, 560, 623, 397);

        jLabel12.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        getContentPane().add(jLabel12);
        jLabel12.setBounds(20, 110, 120, 110);

        pack();
    }// </editor-fold>//GEN-END:initComponents

	private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
		// TODO add your handling code here:
	}//GEN-LAST:event_jButton1ActionPerformed

	private void jBRegresarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBRegresarActionPerformed
		// TODO add your handling code here:
		Gerente iraGerente =new Gerente(laInterfaz);
		iraGerente.setVisible(true);
		this.dispose();
	}//GEN-LAST:event_jBRegresarActionPerformed

	private void jBExaminarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBExaminarActionPerformed
		// TODO add your handling code here:
		FileNameExtensionFilter filter = new FileNameExtensionFilter("JPG", "jpg");
        jFileChooser1.setFileFilter(filter);
		jFileChooser1.setCurrentDirectory(null);
		int returnVal=jFileChooser1.showOpenDialog(this);
		if (returnVal == jFileChooser1.APPROVE_OPTION)
		{
			File file = jFileChooser1.getSelectedFile();
			jLabel12.setIcon (new ImageIcon(file.getAbsolutePath()));

		}
         else {
			System.out.println("Photo Not Found");
		 }


	}//GEN-LAST:event_jBExaminarActionPerformed

    /**
    * @param args the command line arguments
    */
   

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.JButton jBEliminarProducto;
    private javax.swing.JButton jBExaminar;
    private javax.swing.JButton jBRegistrarProducto;
    private javax.swing.JButton jBRegresar;
    private javax.swing.JButton jButton1;
    private javax.swing.JEditorPane jEditorPane1;
    private javax.swing.JFileChooser jFileChooser1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JRadioButton jRadioButton1;
    private javax.swing.JRadioButton jRadioButton2;
    private javax.swing.JRadioButton jRadioButton3;
    private javax.swing.JRadioButton jRadioButton4;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTextField jTCargarImagen;
    private javax.swing.JTextField jTCodigoProducto;
    private javax.swing.JTextField jTDescripcionProducto;
    private javax.swing.JTextField jTFecha;
    private javax.swing.JTextField jTNombreProducto;
    private javax.swing.JTextField jTOfertas;
    private javax.swing.JTextField jTUnidades;
    // End of variables declaration//GEN-END:variables

}
